// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import md5 from 'js-md5'
import store from "./store/index.js"
import api from "./util/api.js"
import VueUeditorWrap from 'vue-ueditor-wrap'

Vue.config.productionTip = false
Vue.component('vue-ueditor-wrap', VueUeditorWrap);
Vue.use(ElementUI);
Vue.prototype.$http= axios
Vue.prototype.$md5 = md5;
Vue.prototype.$api= api
axios.interceptors.request.use(function(config) {
  config.headers['token'] = store.state.token

	return config; // 别忘了返回config
}, function(error) {
	// 对请求错误做些什么处理
	// Promise.reject(reason)方法 可以返回一个带有拒绝原因reason参数的Promise对象。
	return Promise.reject(error);
});
/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  components: { App },
  template: '<App/>'
})
